package com.simple.elpmobile.onlinecase.engine;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class AppInfo
{
	
	
	private static String appVersion = "";
	
	public final static int APP_MODEL_DEBUG = 1;
	public final static int APP_MODEL_RELEASE = 2;
	
	public final static int APP_MODEL =  APP_MODEL_DEBUG;
	
	
	
	public static  String getVersionName(Context context)
	{
		if(appVersion.equals(""))
		{	
			try{
				PackageManager packageManager = context.getPackageManager();
			    // getPackageName()是你当前类的包名，0代表是获取版本信息
			    PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(),0);
			    appVersion = packInfo.versionName;
			}catch(Exception e)
			{
				e.printStackTrace();
			}
		}
	    return appVersion;
    }
	
}